package top.go2do.websiteNavigation.business.website.module;

import jakarta.persistence.*;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @Description
 * @Author xingyj
 * @CreateTime 2025/6/18 11:07
 */
@Entity
@Table(name = "website")
@Data
public class WebsitePO {
    @Id
    @Column(name = "website_id", columnDefinition = "BIGINT UNSIGNED COMMENT '实体ID(雪花算法分布式ID)'")
    private Long websiteId;

    @Column(name = "url", nullable = false, columnDefinition = "VARCHAR(2048) COMMENT '网址'")
    private String url;

    @Column(name = "title", nullable = false, columnDefinition = "VARCHAR(100) COMMENT '网址标题'")
    private String title;

    @Column(name = "description", columnDefinition = "TEXT DEFAULT NULL COMMENT '网址标题'")
    private String description;

    @Column(name = "icon_url", nullable = false, columnDefinition = "VARCHAR(25500) COMMENT '网址的图标'")
    private String iconUrl;

    @Column(name = "category_id", columnDefinition = "BIGINT UNSIGNED DEFAULT NULL COMMENT '所属分类的id'")
    private Long categoryId;

    @Column(name = "is_public", columnDefinition = "BOOLEAN DEFAULT FALSE COMMENT '是否公开分享'")
    private Boolean isPublic;

    @Column(name = "view_count", columnDefinition = "INT DEFAULT 0 COMMENT '被查看次数'")
    private Integer viewCount;

    @Column(name = "sort", columnDefinition = "INT DEFAULT '1' COMMENT '排序权重'")
    private Integer sort;

    @Column(name = "status", nullable = false, columnDefinition = "TINYINT UNSIGNED DEFAULT 1 COMMENT '1正常,2冻结'")
    private Integer status;

    @Column(name = "json_config", nullable = false, columnDefinition = "VARCHAR(1000) DEFAULT '' COMMENT '其他配置（以json字符串存储，例如路由地址、图标名等）'")
    private String jsonConfig;

    @Column(name = "created_at", nullable = false, insertable = false, updatable = false,
            columnDefinition = "DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间'")
    private LocalDateTime createdAt;

    @Column(name = "created_by", nullable = false,
            columnDefinition = "BIGINT UNSIGNED COMMENT '创建者'")
    private Long createdBy;

    @Column(name = "updated_at", nullable = false, insertable = false, updatable = false,
            columnDefinition = "DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '更新时间'")
    private LocalDateTime updatedAt;

    @Column(name = "updated_by", nullable = false,
            columnDefinition = "BIGINT UNSIGNED COMMENT '更新者'")
    private Long updatedBy;
}
